package aria.my12306;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.Window;
import android.view.WindowManager;

public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_splash);
        SharedPreferences pref = getSharedPreferences("user",0);
        String username = pref.getString("username","");
        String password = pref.getString("password","");
        if(TextUtils.isEmpty(username)||TextUtils.isEmpty(password)){
            Intent i=new Intent();
            i.setClass(SplashActivity.this,LoginActivity.class);
            startActivity(i);
        }else {
            Intent i = new Intent();
            i.setClass(SplashActivity.this, MainActivity.class);
            startActivity(i);
        }
        finish();
    }
}
